package cn.itcast.feign.client;

import cn.itcast.hmall.dto.common.ThreadLocalUtil;
import cn.itcast.hmall.pojo.user.Address;
import cn.itcast.hmall.pojo.user.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户服务 feign接口
 * <p>
 * TODO 需要的接口自己补充哦
 */
@FeignClient("userservice")
public interface UserClient {

    /**
     * 扣除用户账户余额
     * @param totalfee 扣除费用
     * @param userId 用户id
     * @return 返回结果
     */
    @GetMapping("/user/pay/{userId}/{totalfee}")
    Boolean payMoney(@PathVariable("totalfee") Long totalfee, @PathVariable("userId") Long userId);

    /**
     * 根据用户id查询用户信息
     *
     * @param userId 用户id
     * @return 返回用户信息
     */
    @GetMapping("/user/{userId}")
    User queryUserById(@PathVariable("userId") Long userId);


    /**
     * 根据地址id查询地址信息
     *
     * @param id 地址id
     * @return
     */
    @GetMapping("/address/{addressId}")
    Address getAddress(@PathVariable("addressId") Long id);
}
